package com.manage.service;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.manage.dao.UserMapper;
import com.manage.model.User;
@Service
public class UserServiceImpl implements UserService {
private UserMapper userMapper;

	public UserMapper getUserMapper() {
	return userMapper;
}
@Autowired
public void setUserMapper(UserMapper userMapper) {
	this.userMapper = userMapper;
}
//获取所用的用户信息
public List<User> listAllUsers() {
	return userMapper.listAllUsers();
}

//删除用户
public void deleteUser(Integer id){
	userMapper.deleteUser(id);
}

//添加用户
public boolean addUser(User user){
		int count =userMapper.insertUser(user);
		if(count>0){
			return true;
		}
		else{
			return false;
		}
	}
	
	@Override
	public User selectUser(User user) {
		return this.userMapper.selectUser(user);
	}

	@Override
	public User updateUser(User user) {
		return this.userMapper.updateUser(user);
	}

	@Override
	public void updateByPrimaryKey(User user) {
		// TODO Auto-generated method stub
		this.userMapper.updateByPrimaryKey(user);
	}

	@Override
	public User selectByPrimaryKey(Integer userid) {
		// TODO Auto-generated method stub
		return this.userMapper.selectByPrimaryKey(userid);
	}
	//获取用户分类信息
	public List<HashMap<String, Object>> countByCategory(
			HashMap<String, Object> map) {
		return userMapper.countByCategory(map);
	}
}
